Skip to content

[fix] Use BaseSubnetDivisionRuleType.get_max_subnet order by subnet #728 - #729

Merged
nemesifier merged 4 commits into
masterfrom
issues/728-get-max-subnet
Dec 20, 2022
Merged

[fix] Use BaseSubnetDivisionRuleType.get_max_subnet order by subnet #728#729
nemesifier merged 4 commits into
masterfrom
issues/728-get-max-subnet

Conversation

@pandafy

@pandafy pandafy commented Dec 12, 2022

Copy link
Copy Markdown
Member

BaseSubnetDivisionRuleType.get_max_subnet will order queryset using
the "subnet" field when PostgreSQL database backend is used. Otherwise,
it will fallback to using "created" field for ordering.

Closes #728

@pandafy
pandafy force-pushed the issues/728-get-max-subnet branch 2 times, most recently from a62586e to dba80d7 Compare December 12, 2022 11:32
@coveralls

coveralls commented Dec 12, 2022

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.0002%) to 98.745% when pulling 58d8e45 on issues/728-get-max-subnet into 2b97872 on master.

@pandafy
pandafy force-pushed the issues/728-get-max-subnet branch from 7745de2 to 7c9996c Compare December 12, 2022 12:31


BaseSubnetDivisionRuleType.get_max_subnet will order queryset using
the "subnet" field when PostgreSQL database backend is used. Otherwise,
it will fallback to using "created" field for ordering.

Closes #728
@pandafy
pandafy force-pushed the issues/728-get-max-subnet branch from 7c9996c to cb7ca74 Compare December 12, 2022 13:00

@nemesifier nemesifier left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any idea of what is happening to the test coverage?

Comment thread openwisp_controller/subnet_division/rule_types/base.py Outdated
Comment thread .github/workflows/ci.yml
Comment thread .github/workflows/ci.yml
coverage run --source=openwisp_controller runtests.py
coverage run --parallel-mode --source=openwisp_controller runtests.py
POSTGRESQL=1 coverage run --parallel-mode --source=openwisp_controller runtests.py
coverage combine

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please try combining these changes with the changes in openwisp/openwisp-users#340 (move flags to rc file and run tests in parallel), in the second call to coverage, in order to avoid increasing the build time excessively, we could run only the tests of the subdivision app, in this case --keepdb should help speed up things a bit.

POSTGRESQL=1 coverage run /tests/manage.py test openwisp_controller.subnet_division.tests

It should work!

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When using POSTGRESQL=1 only a subset of tests are executed. The abstraction is done in runtests.py to allow running the tests locally as well.

if os.environ.get('POSTGRESQL', False):
args.extend(['--tag', 'db_tests'])

@nemesifier
nemesifier merged commit 3a3ae32 into master Dec 20, 2022
@nemesifier
nemesifier deleted the issues/728-get-max-subnet branch December 20, 2022 17:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[fix/change] Avoid depending on creation date in get_max_subnet method

3 participants